Event.observe ( window, 'load', bootstrap );

function bootstrap () {
  /*
  ** TableKit.
  */
  
  TableKit.options.editAjaxURI = '/rest/component';
  
  /*
  ** Component types.
  */
  
  new Ajax.Request ( '/rest/component_types', {
    method         : 'get',
    requestHeaders : { Accept : 'application/json' },
    onComplete     : function ( transport ) {
      var component_types = [ [ '-', '' ] ]; /* text, value */

      transport.responseJSON.each ( function ( component_type ) { component_types.push ( [ component_type.id, component_type.id ] ) } );

      TableKit.Editable.selectInput ( 'type_id', {}, component_types );
    }
  } );
  
  /*
  ** Tabtabulous.
  */
  
  new Fabtabs ( 'fabtabs' );
}
